//package com.example.beautyhub;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//@Configuration
//public class CorsConfig implements WebMvcConfigurer {
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new CorsInterceptor());
//    }
//
//    private static class CorsInterceptor implements HandlerInterceptor {
//        @Override
//        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
////            response.setHeader("Access-Control-Allow-Origin", "http://localhost:8080");
//            response.setHeader("Access-Control-Allow-Origin", "http://192.168.31.243");
//            response.setHeader("Access-Control-Allow-Headers", "Content-Type");
//            response.setHeader("Access-Control-Allow-Methods", "GET, POST");
//            return true;
//        }
//    }
//}
